local jiaoting = fk.CreateSkill{
  name = "#rfenghou_3d18j__jiaoting_active",
}

jiaoting:addEffect("viewas", {
  prompt = function(self, player, selected_cards, selected)
    local card_name = self.card_name
    local another_name = self.another_name
    if #selected_cards == 2 then
      return "#rfenghou_3d18j__jiaoting-invoke2:::" .. card_name .. ":" .. table.concat(table.map(another_name, function(cname) return "【" .. Fk:translate(cname) .. "】" end), "/")
    elseif #selected_cards == 1 then
      return "#rfenghou_3d18j__jiaoting-invoke1:::" .. card_name
    end
    return "#rfenghou_3d18j__jiaoting-invoke0:::" .. card_name
  end,
  min_card_num = 1,
  max_card_num = 2,
  card_filter = function(self, player, to_select, selected, selected_targets)
    return #selected < 2 and not player:prohibitDiscard(to_select)
  end,
  view_as = function(self, player, cards)
    if #cards < 1 then return end
    local c = Fk:cloneCard(self.card_name)
    c.skillName = "rfenghou_3d18j__jiaoting"
    c:addFakeSubcards(cards)
    return c
  end
})

Fk:loadTranslationTable{
  ["#rfenghou_3d18j__jiaoting-invoke1"] = "浇廷：你可以弃置一张牌，视为使用【%arg】，然后此回合结束时，你失去1点体力",
  ["#rfenghou_3d18j__jiaoting-invoke2"] = "浇廷：你可以弃置两张牌，视为使用【%arg】，然后你视为使用%arg2",
}

return jiaoting
